package com.wg.game;

import com.wg.core.properties.PropertiesMgr;

/**
 * 游戏配置
 *
 * @author 少爷123
 */
public class GameConfig {
    /**
     * 当前游戏进程PID文件位置。
     * <p>
     * pid.file=/data/server01/game.pid
     */
    private final String pidFile;

    /**
     * java脚本所在目录
     */
    private final String scriptSourcePath;

    public GameConfig() {
        pidFile = PropertiesMgr.getStr(GameConstant.PID_FILE);
        scriptSourcePath = PropertiesMgr.getStr(GameConstant.SCRIPT_SOURCE_PATH);
    }

    public static GameConfig getInstance() {
        return Singleton.INSTANCE.getManager();
    }

    public String getPidFile() {
        return pidFile;
    }

    public String getScriptSourcePath() {
        return scriptSourcePath;
    }

    private enum Singleton {
        INSTANCE;

        final GameConfig manager;

        Singleton() {
            this.manager = new GameConfig();
        }

        GameConfig getManager() {
            return manager;
        }
    }
}
